﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MinhTuan;

public partial class users_register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            
            Session["user"] = "-1,gues,false";
        }
    }
    
    protected void btndangky_Click(object sender, EventArgs e)
    {
        if (String.Compare(Session["strcapcha"].ToString().ToLower(), this.txtcapcha.Text.Trim().ToLower(), true) == 0)
        {
            Members member = new Members();
            member.Members_Name = txthoten.Text;
            member.Members_City = txtthanhpho.Text;
            member.Members_Address = txtdiachi.Text;
            member.Members_Mail = txtemail.Text;
            member.Members_Tel = txtdienthoai.Text;
            member.Members_DateJoin = DateTime.Now;
            member.Members_LastLogin = DateTime.Now;
            member.Members_Login = txttendangnhap.Text;
            member.Members_Password = txtmatkhau.Text;
            int result = Members.AddMember(member);
            if (result > 0)
            {
                Lthongbao.Text = "Tài khoản " + member.Members_Name + " đăng ký thành công";
            }
            else
            {
                Lthongbao.Text = "Đăng ký không thành công";
                return;
            }
        }
        else
        {
            this.Lthongbao.Text = "Mã xác nhận không đúng";
            return;
        }

    }
}
